package part1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Java5Ex4 Example of variable number of arguments
 * 
 * @author tony
 * 
 */

public class Java5Ex4 {
	public int process(int x, int y, int ... z){
		int sum = x + y;
		for (int i: z)
			sum = sum + i;
		return sum;
	}
	public static void main(String[] args) {
		int a = 5, b = 6, c = 7, d = 8;
		Java5Ex4 obj = new Java5Ex4();
		
		int result = obj.process( a, b );
		System.out.println(" process( a, b ) returned " + result );

		result = obj.process( a, b, c );
		System.out.println(" process( a, b, c ) returned " + result );

		result = obj.process( a, b, c, d );
		System.out.println(" process( a, b, c, d ) returned " + result );
	}
}